﻿@inject IStringLocalizer<DialogApply> Localizer

<div class="row g-3">
    <div class="col-12 col-sm-6">
        <Select @bind-Value="@DataPrimaryId" DisplayText="@Localizer["ApplyDisplayText"]" ShowLabel="true">
            <Options>
                <SelectOption Text="1" Value="1"/>
                <SelectOption Text="2" Value="2"/>
                <SelectOption Text="3" Value="3"/>
                <SelectOption Text="4" Value="4"/>
                <SelectOption Text="5" Value="5"/>
                <SelectOption Text="6" Value="6"/>
                <SelectOption Text="7" Value="7"/>
                <SelectOption Text="8" Value="8"/>
                <SelectOption Text="9" Value="9"/>
                <SelectOption Text="10" Value="10"/>
            </Options>
        </Select>
    </div>
    <div class="col-12 col-sm-6 align-self-end">
        <Button OnClick="@OnClickShowDataById">@Localizer["ApplyOpenDialogButton"]</Button>
    </div>
</div>

@code {
    [Inject]
    [NotNull]
    private DialogService? DialogService { get; set; }

    private int DataPrimaryId { get; set; } = 1;

    private async Task OnClickShowDataById()
    {
        var op = new DialogOption()
        {
            Title = "Data query window",
            ShowFooter = false,
            BodyContext = DataPrimaryId
        };
        op.Component = BootstrapDynamicComponent.CreateComponent<DataDialogComponent>();

        await DialogService.Show(op);
    }
}
